#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2024/12/30 23:21
# @Author : George
import asyncio
import time

start = time.time()


async def request(url):
    print("开始下载", url)
    await asyncio.sleep(2)
    print("下载完毕", url)


async def main():
    url = [
        "http://httpbin.org",
        "http://httpbin2.org",
        "http://httpbin3.org"
    ]
    task_list = [asyncio.create_task(request(i)) for i in url]
    await asyncio.wait(task_list)


asyncio.run(main())

end = time.time()
print("耗时:", end - start)  # 耗时: 2.0125069618225098
